package com.qfedu.controller;

import com.qfedu.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("ajax")
public class AjaxController {
//    @PostMapping("demo")
//    @ResponseBody
//    public String demo(String username,int age) {
//        System.out.println(username);
//        System.out.println(age);
//        return "aa";
//    }
    @PostMapping("demo")
    @ResponseBody
    public String demo(User user){
        System.out.println(user);
        return "aa";
    }
    @PostMapping("json")
    @ResponseBody   //响应的是json数据格式
    public User demo02(@RequestBody User user){   //@RequestBody  :contentType:applicaton/json;charset=UTF-8
        System.out.println(user);
        return user;
    }
}